package week10.MidEx;


import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class PlaneFactory {

    private static Properties prop = new Properties();
    //加载配置文件
    static {
        try {
            prop.load(new FileInputStream("src/week10/MidEx/flying.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static Plane createPlane() {
        //TODO 键值保存工厂方法
        Plane iaa = null;
        try {
            iaa = (Plane) Class.forName(prop.getProperty("plane")).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return iaa;
    }

}
